
 if( SERVER ) then

	AddCSLuaFile( "shared.lua" );

end


 

SWEP.PrintName      = "Medic Kit"   
SWEP.Author   = "Jake Johnson"
SWEP.Slot         = 0;
SWEP.SlotPos            = 3;
SWEP.Description        = "Heals the wounded."
SWEP.Contact            = ""
SWEP.Purpose            = ""
SWEP.Instructions      = "Left Click to heal player infront of user."

 
SWEP.Spawnable      = true --  Change to false to make Admin only.
SWEP.AdminSpawnable  = true
 
SWEP.ViewModel      = "models/Items/HealthKit.mdl"
SWEP.WorldModel   = "models/Items/HealthKit.mdl"
 
SWEP.Primary.Recoil  = 0
SWEP.Primary.ClipSize      = -1
SWEP.Primary.DefaultClip    = 1
SWEP.Primary.Automatic    = false
SWEP.Primary.Delay    = 10
SWEP.Primary.Ammo      = "none"
 
SWEP.Secondary.Recoil      = 0
SWEP.Secondary.ClipSize  = -1
SWEP.Secondary.DefaultClip  = 1
SWEP.Secondary.Automatic    = true
SWEP.Secondary.Delay        = 0.3
SWEP.Secondary.Ammo  = "none"
 

util.PrecacheSound("HL1/fvox/medical_repaired.wav")
util.PrecacheSound("HL1/fvox/radiation_detected.wav")
util.PrecacheSound("HL1/fvox/automedic_on.wav")

function SWEP:GetViewModelPosition( pos, ang )
 
	pos = pos + self.Owner:GetForward()*20 + self.Owner:GetUp()*-15
	
	ang:RotateAroundAxis( ang:Right(), 40 )
 
	return pos, ang
 
end

function SWEP:PrimaryAttack()
 
trace = {}
trace.start = self.Owner:GetShootPos()
trace.endpos = trace.start + (self.Owner:GetAimVector() * 85)
trace.filter = { self.Owner, self.Weapon }
tr = util.TraceLine( trace )
 
	if (tr.HitNonWorld) then
		
		local enthit = tr.Entity
		self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
		self.Owner:SetNWFloat("MedRel",CurTime() + self.Primary.Delay )
		self.Owner:SetNWBool("MedFired", true )
        enthit:SetHealth( 100 )
		self.Owner:EmitSound("HL1/fvox/medical_repaired.wav", 150, 100)

	end
end
		